/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VIstaProducto.java
 *
 * Created on 06/04/2011, 02:12:56 AM
 */

package vistas;

import java.awt.event.ActionListener;
import java.util.LinkedList;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
/**
 *
 * @author usuario
 */
public class VIstaProducto extends javax.swing.JFrame {

    private controladores.ControladorProducto control;

    /** Creates new form VIstaProducto */
    public VIstaProducto() {
        initComponents();
        control= new controladores.ControladorProducto(this);
        
      
        
////        reiniciar();
    }

    public JButton getCancelar() {
        return cancelar;
    }

    public JComboBox getCmbCategoria() {
        return cmbCategoria;
    }

    public JComboBox getCmbIngredientes() {
        return cmbIngredientes;
    }

    public JTextField getCodigo() {
        return codigo;
    }

    public JTextField getDescripcion() {
        return descripcion;
    }

    public JButton getMas() {
        return mas;
    }

    public JButton getMenos() {
        return menos;
    }

    public JButton getRegistrar() {
        return registrar;
    }

    public JButton getSalir() {
        return salir;
    }

    public JTextField getCantidad() {
        return cantidad;
    }

    public JTextField getPrecio() {
        return precio;
    }


    public void addListener(ActionListener escuchador){
        salir.addActionListener(escuchador);
        registrar.addActionListener(escuchador);
        cancelar.addActionListener(escuchador);
        mas.addActionListener(escuchador);
        menos.addActionListener(escuchador);
    }


    

    public JTable getTblIngrediente() {
        return tblIngrediente;
    }

    


     public LinkedList<JTextField> getTextos() {
        LinkedList<JTextField> v = new LinkedList<JTextField>();
        v.add(codigo);
        v.add(descripcion);
        v.add(precio);
        v.add(cantidad);
        return v;
    }

    public String [] getRegistro(){
        String [] s = new String [] {""+cmbIngredientes.getItemAt(cmbIngredientes.getSelectedIndex()),cantidad.getText()};

         return s;
    }

     

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        tblIngrediente = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblIngrediente1 = new javax.swing.JTable();
        jLabel11 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        cmbCategoria = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        precio = new javax.swing.JTextField();
        descripcion = new javax.swing.JTextField();
        codigo = new javax.swing.JTextField();
        registrar = new javax.swing.JButton();
        cancelar = new javax.swing.JButton();
        salir = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        cantidad = new javax.swing.JTextField();
        cmbIngredientes = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        mas = new javax.swing.JButton();
        menos = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Registro de Productos");
        getContentPane().setLayout(null);

        tblIngrediente.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(tblIngrediente);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(30, 370, 590, 160);

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel1.setLayout(null);

        tblIngrediente1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(tblIngrediente1);

        jPanel1.add(jScrollPane2);
        jScrollPane2.setBounds(20, 470, 650, 160);

        jLabel11.setFont(new java.awt.Font("Ubuntu", 1, 15));
        jLabel11.setText("Ingredientes");
        jPanel1.add(jLabel11);
        jLabel11.setBounds(420, 270, 110, 30);

        jLabel6.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel6.setText("Codigo:");
        jPanel1.add(jLabel6);
        jLabel6.setBounds(70, 50, 130, 30);

        jLabel1.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel1.setText("Categoria:");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(70, 10, 140, 32);

        jPanel1.add(cmbCategoria);
        cmbCategoria.setBounds(190, 10, 190, 30);

        jLabel2.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel2.setText("Descripcion:");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(70, 90, 140, 32);

        jLabel3.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel3.setText("Precio:");
        jPanel1.add(jLabel3);
        jLabel3.setBounds(70, 130, 224, 32);

        precio.setFont(new java.awt.Font("Arial", 0, 13));
        jPanel1.add(precio);
        precio.setBounds(190, 130, 190, 30);

        descripcion.setFont(new java.awt.Font("Arial", 0, 13));
        jPanel1.add(descripcion);
        descripcion.setBounds(190, 90, 190, 32);
        jPanel1.add(codigo);
        codigo.setBounds(190, 50, 190, 30);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(30, 40, 440, 180);

        registrar.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        registrar.setText("Registrar");
        registrar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(registrar);
        registrar.setBounds(490, 40, 120, 30);

        cancelar.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        cancelar.setText("Cancelar");
        cancelar.setPreferredSize(new java.awt.Dimension(80, 30));
        getContentPane().add(cancelar);
        cancelar.setBounds(490, 90, 120, 30);

        salir.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        salir.setText("Salir");
        getContentPane().add(salir);
        salir.setBounds(490, 140, 120, 34);

        jPanel2.setBorder(new javax.swing.border.MatteBorder(null));
        jPanel2.setLayout(null);

        cantidad.setFont(new java.awt.Font("Arial", 0, 13)); // NOI18N
        jPanel2.add(cantidad);
        cantidad.setBounds(130, 70, 170, 30);

        jPanel2.add(cmbIngredientes);
        cmbIngredientes.setBounds(130, 20, 170, 30);

        jLabel5.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel5.setText("Ingredientes");
        jPanel2.add(jLabel5);
        jLabel5.setBounds(20, 20, 240, 30);

        jLabel7.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        jLabel7.setText("Cantidad");
        jPanel2.add(jLabel7);
        jLabel7.setBounds(20, 70, 200, 30);

        getContentPane().add(jPanel2);
        jPanel2.setBounds(30, 240, 320, 110);

        mas.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        mas.setText("+");
        getContentPane().add(mas);
        mas.setBounds(370, 250, 120, 30);

        menos.setFont(new java.awt.Font("Arial Black", 0, 15)); // NOI18N
        menos.setText("-");
        getContentPane().add(menos);
        menos.setBounds(370, 300, 120, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-633)/2, (screenSize.height-592)/2, 633, 592);
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VIstaProducto().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton cancelar;
    private javax.swing.JTextField cantidad;
    private javax.swing.JComboBox cmbCategoria;
    private javax.swing.JComboBox cmbIngredientes;
    private javax.swing.JTextField codigo;
    private javax.swing.JTextField descripcion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JButton mas;
    private javax.swing.JButton menos;
    private javax.swing.JTextField precio;
    private javax.swing.JButton registrar;
    private javax.swing.JButton salir;
    private javax.swing.JTable tblIngrediente;
    private javax.swing.JTable tblIngrediente1;
    // End of variables declaration//GEN-END:variables



}
